<template>
  <div class="flex items-center">
    <el-avatar
      class="cursor-pointer px-2"
      :size="25"
      src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png"
    ></el-avatar>

    <el-dropdown class="pl-1">
      <span class="el-dropdown-link">
        {{ username }}
      </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item icon="el-icon-plus">用户信息</el-dropdown-item>
          <el-dropdown-item>系统管理</el-dropdown-item>
          <el-dropdown-item divided>退出登录</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script setup lang="ts">
import { useStore } from '@/store'
import { computed } from 'vue'

const store = useStore()
const username = computed(() => store.state.login.userinfo.username)
</script>

<style scoped></style>
